#ifndef SWIPESTACKWIDGET_H
#define SWIPESTACKWIDGET_H
#include <QStackedWidget>
#include <QPropertyAnimation>
#include <QObject>

/**
 * @brief The SwipeStackWidget class
 * 主页面滑动卡片类
 */
class SwipeStackWidget : public QStackedWidget
{
    Q_OBJECT
public:
    SwipeStackWidget(QWidget * parent = nullptr) : QStackedWidget(parent) {};

protected:
    void mousePressEvent(QMouseEvent *event) override;

    void mouseMoveEvent(QMouseEvent * event) override;
private:
    QPoint startPos;                                // 滑动起始点
    bool moving = false;                            // 标识是否正在切换

    void slideToIndex(int index, bool slideRight);  // 切换页面实现

signals:
    void pageChanged(int index);                    // 切换页面发出信号给下方显示点
};

#endif // SWIPESTACKWIDGET_H
